<?php 
header("Content-type:text/html;charset=utf-8");
require_once('./system/dbConnect.php');
connect();
$id=$_GET['id'];
$sql="select * from videos where tid={$id}";
$result=fetch_array($sql);
$sql_vt="select typename from videotype where tid={$id}";
$result_vt=fetch_array($sql_vt);
$sql_hits="select * from videos  where tid={$id} order by hittimes desc limit 0,4";
$hits_list=fetch_array($sql_hits);

 ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>Off Canvas Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="assets/css/offcanvas.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]>
    <script src="assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="assets/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<?php require_once('header.php'); ?>

<!-- /.navbar -->


<div class="container">

    <div class="row row-offcanvas row-offcanvas-right">

        <div class="col-xs-12 col-sm-9">


            <div class="row">
            <?php foreach ($result_vt as $key)  ?>

                <div class="col-xs-12 col-lg-12 mlist text-center">
                    <h2><?php echo $key['typename'];  ?></h2>
                    <ul class="list-inline row text-center">
                    <?php   foreach ($result as $one) {
                     echo '<li class="col-xs-6 col-lg-3"><img src="images/'.$one['pic'].'" class="responsive img-thumbnail"/>
                            <p><a href="show.php?id='.$one['vid'].'">'.$one['videoname'].'</a>
                            </p></li>';
                    } 

                    ?>
                      

                    </ul>
                    <nav class="text-center">
                        <ul class="pagination">
                            <li>
                                <a href="#" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            <li><a href="#">1</a></li>
                            <li><a href="#">2</a></li>
                            <li><a href="#">3</a></li>
                            <li><a href="#">4</a></li>
                            <li><a href="#">5</a></li>
                            <li>
                                <a href="#" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </ul>
                    </nav>


                </div>
                <!--/.col-xs-6.col-lg-4-->

            </div>
            <!--/row-->
        </div>
        <!--/.col-xs-12.col-sm-9-->

        <div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar">
            <div class="list-group text-center" >
                <h2 style="color:white;">点击排行</h2>
                <ul class="list-inline row text-center">
                <?php 
                foreach ($hits_list as $row) {
                    echo '<li class="col-xs-12 col-lg-6"><img src="images/'.$row['pic'].'" class="responsive img-thumbnail"/>

                        <p><a href="show.php?id='.$row['vid'].'">'.$row['videoname'].'</a>
                        </p></li>';


                    
                }




                 ?>


                </ul>
            </div>

        </div>
        <!--/.sidebar-offcanvas-->
    </div>
    <!--/row-->

    

</div>
<!--/.container-->
<hr>

    <footer>
        <p>&copy; Company 2014</p>
    </footer>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>

<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="assets/js/ie10-viewport-bug-workaround.js"></script>

<script src="offcanvas.js"></script>
</body>
</html>
